From 0097713a1b7d902ba77ba2a29758c62ee2fb8647 Mon Sep 17 00:00:00 2001 From: oliskoli Date: Sun, 30 Apr 2006 16:59:38 +0000 Subject: [PATCH] Add procedure to convert Garmin 'display' value between waypoint protocols. --- gpsbabel/garmin_tables.c | 46 ++++++++++++++++++++++++++++++++++++++++ gpsbabel/garmin_tables.h | 2 ++ 2 files changed, 48 insertions(+) diff --git a/gpsbabel/garmin_tables.c b/gpsbabel/garmin_tables.c index e6fc88c70..06030623b 100644 --- a/gpsbabel/garmin_tables.c +++ b/gpsbabel/garmin_tables.c @@ -494,6 +494,52 @@ char *gt_display_mode_names[] = { "Symbol & Description" }; +unsigned char +gt_switch_display_mode_value(const unsigned char display_mode, const int protoid, const char device) +{ + if (device) { + switch(protoid) { + + case 103: + case 107: + case 108: + case 109: + case 110: return display_mode & 3; + case 104: + switch(display_mode) { + case 0: + case 1: return gt_display_mode_symbol; + case 3: return gt_display_mode_symbol_and_name; + case 5: return gt_display_mode_symbol_and_comment; + } + case 155: + switch(display_mode) { + case 1: return gt_display_mode_symbol; + case 3: return gt_display_mode_symbol_and_name; + case 5: return gt_display_mode_symbol_and_comment; + } + } + return gt_display_mode_symbol_and_name; + } else { + switch(protoid) { + + case 103: + case 107: + case 108: + case 109: + case 110: return display_mode & 3; + case 104: + case 155: + switch(display_mode) { + case gt_display_mode_symbol: return 1; + case gt_display_mode_symbol_and_name: return 3; + case gt_display_mode_symbol_and_comment: return 5; + } + } + return 0; + } +} + char * gt_find_desc_from_icon_number(const int icon, garmin_formats_e garmin_format, int *dynamic) { diff --git a/gpsbabel/garmin_tables.h b/gpsbabel/garmin_tables.h index 350a47f19..79667843c 100644 --- a/gpsbabel/garmin_tables.h +++ b/gpsbabel/garmin_tables.h @@ -90,4 +90,6 @@ typedef enum { unsigned char gt_convert_category(const char *name, int *category); +unsigned char gt_switch_display_mode_value(const unsigned char display_mode, const int protoid, const char device); + #endif -- 2.30.2